numbers = [23, 32, 1, 3, 4, 19, 20, 2, 4]
def magic_bubble_sort(numbers):
    j = len(numbers) - 1
    while j>0:
        for i in range(j):
            if numbers[i] % 2 == 0 and numbers[i+1] % 2 == 1:
                numbers[i], numbers[i+1] = numbers[i+1], numbers[i]
                continue
            elif(numbers[i] % 2 == numbers[i+1] % 2) and numbers[i] > numbers[i+1]:
                numbers[i], numbers[i+1] = numbers[i+1], numbers[i]
                continue   
        j -= 1
    return numbers
print(magic_bubble_sort(numbers))